﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Maticsoft.BLL;
using Maticsoft.Model;
using System.Data;
using System.Data.SqlClient;

namespace FineUI.Examples
{
    public partial class major_update : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                string kecheng_name = Request.QueryString["kecheng_name"];
                string a = Request.QueryString["a"];
                string c = Request.QueryString["c"];
                string d = Request.QueryString["d"];
                string eee = Request.QueryString["e"];
                string f = Request.QueryString["f"];

                //TextBox7.Text = id;
                //int a = Convert.ToInt32(TextBox7.Text);
                Maticsoft.BLL.major majorinfo = new Maticsoft.BLL.major();
                //Label1.Text = kecheng_name;
                //DataTable kechengInfo = majorinfo.selAllKechengInfoByKeId(kecheng_name);
                Label1.Text = kecheng_name;
                TextBox1.Text = a;
                TextBox2.Text = c;
                TextBox3.Text = d;
                TextBox4.Text = eee;
                TextBox5.Text = f;
            }
        }
        public void btnAdd_Click(object sender, EventArgs e)
        {
            string kecheng_name = Request.QueryString["kecheng_name"];
            string kecheng_name2 = Label1.Text;
            string a2= TextBox1.Text.Trim();
            string c2 = TextBox2.Text.Trim();
            string d2 = TextBox3.Text.Trim();
            string e2 = TextBox4.Text.Trim();
            string f2 = TextBox5.Text.Trim();
            
            Maticsoft.BLL.major majorinfo = new Maticsoft.BLL.major();
            bool updateKecheng = majorinfo.updateKEchenginfo2(kecheng_name, a2, c2, d2, e2, f2);
            if (updateKecheng)
            {
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('修改成功！');</script>");
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('修改成功，请重新查询专业表！');</script>");
            }
            //int kecheng_id = int.Parse((string)id);
            //使用Convert.ToInt32(string s)进行转换
            //int kecheng_id = Convert.ToInt32(id);
            //Maticsoft.BLL.major majorinfo = new Maticsoft.BLL.major();
            //updateKecheng.DataSource = majorinfo.selAllKechengInfoByKeId(kecheng_id);
            //string kecheng_name = Request["Text1"].ToString();
            //string a = Request["Text1"].ToString();
            //string c = Request["Text1"].ToString();
            //string d = Request["Text1"].ToString();
            //string ee = Request["Text1"].ToString();
            //string f = Request["Text1"].ToString(); 
        }
        public void btnInsert_Click(object sender, EventArgs e)
        {
            string kecheng_name = Request.QueryString["kecheng_name"];
        }

    }
}